#-*- encoding: utf-8 -*-

'''
Created on 2011-9-22

@author: wu botao
'''

import cx_Oracle 

import os
import pylog
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'

DATABASES = {
    'NAME': 'ORCL',
    'USER': 'infohold',
    'PASSWORD': 'u7yji8',
    'HOST': '192.168.0.43',
    'PORT': '1521',
}

#DATABASES = {
#    'NAME': 'ORCL',
#    'USER': 'giilbsdb',
#    'PASSWORD': '1',
#    'HOST': '192.168.0.43',
#    'PORT': '1521',
#}

logger = pylog.init('./log/')

def openConnection():
    try:
        dsn = cx_Oracle.makedsn(DATABASES['HOST'], DATABASES['PORT'], DATABASES['NAME'])
        db = cx_Oracle.connect(DATABASES['USER'], DATABASES['PASSWORD'], dsn)
    except Exception, e: 
        logger.error(e);
    return db

